home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16420 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.sprintlink.net!datalytics!usenet
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: easy c++ question
  5. Date: Wed, 10 Apr 1996 16:26:24 -0400
  6. Organization: Datalytics, Inc
  7. Message-ID: <316C1970.67F7@datalytics.com>
  8. References: <316901DA.3138C677@ablecom.net> <4kgnd8$5hp@sun0.urz.uni-heidelberg.de>
  9. NNTP-Posting-Host: 204.62.224.71
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Paul Starzetz wrote:
  16. > In article 3138C677@ablecom.net,  The Letter O <jczech@ablecom.net> writes:
  17. > class stack {
  18. > >    private:
  19. > >        int count;       // number of items in the stack
  20. > >        int data[100];   // the items themselves
  21. > >    public:
  22. > >    .
  23. > >inline stack::stack(void)
  24. > >{
  25. > >        count = 0;      // zero the stack
  26. > >        cout << "constructor has been called\n";
  27. > >}
  28. > >//==============================================
  29. > >
  30. > try to flush the output stream, otherwise you will not see anything!
  31. > I have some Unix experience and have already encoutered this problem.
  32. > Try:
  33. > #include <iomanip.h>
  34. > inline stack::stack(void)
  35. > {
  36. >         count = 0;      // zero the stack
  37. >         cout << "constructor has been called\n";
  38. >         cout << flush;
  39.  
  40. Why are you going to this trouble?  If you need a newline and a 
  41. call to flush, use endl:
  42.  
  43.     cout << "in stack::stack" << endl;
  44.  
  45. BTW, note that I made the diagnostic a little more useful by 
  46. including the class and function name.
  47.  
  48. > }
  49. > ...otherwise use another compiler !!!
  50.  
  51. -- 
  52. Robert Stewart        | My opinions are usually my own.
  53. Datalytics, Inc.    | stew@datalytics.com
  54.